﻿<h1>Hello World!</h1>

<hr />

@Html.ActionLink("Boom!", "Boom", null, new { @class = "btn btn-primary" })
@Html.ActionLink("Custom Boom!", "CustomBoom", null, new { @class = "btn btn-primary" })
@Html.ActionLink("Boom 25!", "Boom25", null, new { @class = "btn btn-primary" })
@Html.ActionLink("Manual Stacking", "ManualStacking", new { myId = "123456789" }, new { @class = "btn btn-primary" })

<hr />

<a href="javascript:doAjax()" class="btn btn-primary">Ajax Boom</a>

<a href="javascript:doHugeAjax()" class="btn btn-primary">Huge Ajax Boom</a>

<a href="javascript:doApiAjax()" class="btn btn-primary">Api GET Boom</a>

<a href="javascript:doApiPostAjax()" class="btn btn-primary">Api POST Boom</a>

<hr />

@using (Html.BeginForm("CreateRequestValidationException", "Home", FormMethod.Post))
{
    @Html.Hidden("value", "&#134")
    <input type="submit" class="btn btn-primary" value="Create HttpRequestValidationException" />

}

<hr />

@using (Html.BeginForm("Index", "Home", FormMethod.Post))
{
    @Html.Hidden("Test", "test value")
    @Html.Hidden("Blah", "blah value")
    <input type="submit" class="btn btn-primary" value="Form Boom" />

}

<script type="text/javascript">
    function doAjax() {
        $.ajax({
            type: "POST",
            url: "/Home/AjaxMethod",
            data: JSON.stringify({ Test: 'test value', Blah: 'blah value' }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) { alert(data); },
            failure: function (errMsg) {
                alert(errMsg);
            }
        });
    }

    function doHugeAjax() {
        var data = repeat('01234567890', 5000);
        $.ajax({
            type: "POST",
            url: "/Home/AjaxMethod",
            data: JSON.stringify({ Test: data, Blah: 'blah value' }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) { alert(data); },
            failure: function (errMsg) {
                alert(errMsg);
            }
        });
    }

    function repeat(str, num) {
        return (new Array(num + 1)).join(str);
    }

    function doApiAjax() {
        $.ajax({
            type: "GET",
            url: "/api/values",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) { alert(data); },
            failure: function (errMsg) {
                alert(errMsg);
            }
        });
    }

    function doApiPostAjax() {
        $.ajax({
            type: "POST",
            url: "/api/values",
            data: JSON.stringify({ Name: "Test" }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) { alert(data); },
            failure: function (errMsg) {
                alert(errMsg);
            }
        });
    }
</script>